home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / PRG / ICProgKit 1.3.sit / ICProgKit1.3 / Internet Config Source / ICSwitchGlue.p < prev    next >
Text File  |  1996-07-14  |  41KB  |  877 lines

  1. unit ICSwitchGlue;
  2.  
  3. (* ・・・Start Header・・・ *)
  4.  
  5. (* File:         ICSwitchGlue.p (impl)
  6.  * Generated by: 1.0d4
  7.  * For:          IC 1.3
  8.  * On:           Sunday, 14 July 1996, 20:19:55
  9.  * 
  10.  * This file is part of the Internet Configuration system and
  11.  * is placed in the public domain for the benefit of all.
  12.  *)
  13.  
  14. (* ・・・End Header・・・ *)
  15.  
  16. interface
  17.  
  18.     uses
  19. {$ifc undefined THINK_Pascal}
  20.         Types, Files, QuickDraw, AppleTalk, Aliases, 
  21. {$endc}
  22.         ICTypes, ICKeys;
  23.  
  24. (* ・・・Start ICAPI.p・・・ *)
  25.  
  26.   (* ***** Starting Up and Shutting Down ***** *)
  27.   
  28.   function ICStart(var inst : ICInstance; creator : OSType) : ICError;
  29.     (* Call this at application initialisation. Set creator to your application
  30.      * creator to allow for future expansion of the IC system. Returns
  31.      * inst as a connection to the IC system.
  32.      *)
  33.   
  34.   function ICStop(inst : ICInstance) : ICError;
  35.     (* It is illegal to call this routine inside a ICBegin/End pair.
  36.      * Call this at application initialisation, after which inst
  37.      * is no longer valid connection to IC.
  38.      *)
  39.   
  40.   (* ***** Specifying a Configuration ***** *)
  41.   
  42.   function ICFindConfigFile(inst : ICInstance; count : integer; folders : ICDirSpecArrayPtr) : ICError;
  43.     (* It is illegal to call this routine inside a ICBegin/End pair.
  44.      * Call to configure this connection to IC.
  45.      * Set count as the number of valid elements in folders.
  46.      * Set folders to a pointer to the folders to search.
  47.      * Setting count to 0 and folders to nil is OK.
  48.      * Searches the specified folders and then the Preferences folder
  49.      * in a unspecified manner.
  50.      *)
  51.   
  52.   function ICFindUserConfigFile(inst : ICInstance; var where : ICDirSpec) : ICError;
  53.     (* Requires IC 1.1.
  54.      * It is illegal to call this routine inside a ICBegin/End pair.
  55.      * Similar to ICFindConfigFile except that it only searches the folder
  56.      * specified in where.  If the input parameters are valid the routine
  57.      * will always successful configure the instance, creating an
  58.      * empty configuration if necessary
  59.      * For use with double-clickable preference files.
  60.      *)
  61.   
  62.   function ICGeneralFindConfigFile(inst : ICInstance; search_prefs : Boolean; can_create : Boolean; count : integer; folders : ICDirSpecArrayPtr) : ICError;
  63.     (* Requires IC 1.2.
  64.      * It is illegal to call this routine inside a ICBegin/End pair.
  65.      * Call to configure this connection to IC.
  66.      * This routine acts as a more general replacement for
  67.      * ICFindConfigFile and ICFindUserConfigFile.
  68.      * Set search_prefs to true if you want it to search the preferences folder.
  69.      * Set can_create to true if you want it to be able to create a new config.
  70.      * Set count as the number of valid elements in folders.
  71.      * Set folders to a pointer to the folders to search.
  72.      * Setting count to 0 and folders to nil is OK.
  73.      * Searches the specified folders and then optionally the Preferences folder
  74.      * in a unspecified manner.
  75.      *)
  76.   
  77.   function ICChooseConfig(inst : ICInstance) : ICError;
  78.     (* Requires IC 1.2.
  79.      * It is illegal to call this routine inside a ICBegin/End pair.
  80.      * Requests the user to choose a configuration, typically using some
  81.      * sort of modal dialog. If the user cancels the dialog the configuration
  82.      * state will be unaffected.
  83.      *)
  84.   
  85.   function ICChooseNewConfig(inst : ICInstance) : ICError;
  86.     (* Requires IC 1.2.
  87.      * It is illegal to call this routine inside a ICBegin/End pair.
  88.      * Requests the user to create a new configuration, typically using some
  89.      * sort of modal dialog. If the user cancels the dialog the configuration
  90.      * state will be unaffected.
  91.      *)
  92.   
  93.   function ICGetConfigName(inst : ICInstance; longname : Boolean; var name : Str255) : ICError;
  94.     (* Requires IC 1.2.
  95.      * You must specify a configuration before calling this routine.
  96.      * Returns a string that describes the current configuration at a user
  97.      * level. Set longname to true if you want a long name, up to 255
  98.      * characters, or false if you want a short name, typically about 32
  99.      * characters.
  100.      * The returned string is for user display only. If you rely on the
  101.      * exact format of it, you will conflict with any future IC
  102.      * implementation that doesn't use explicit preference files.
  103.      *)
  104.   
  105.   function ICGetConfigReference(inst : ICInstance; ref : ICConfigRefHandle) : ICError;
  106.     (* Requires IC 1.2.
  107.      * You must specify a configuration before calling this routine.
  108.      * Returns a self-contained reference to the instance's current
  109.      * configuration.
  110.      * ref must be a valid non-nil handle and it will be resized to fit the
  111.      * resulting data.
  112.      *)
  113.   
  114.   function ICSetConfigReference(inst : ICInstance; ref : ICConfigRefHandle; flags : longint) : ICError;
  115.     (* Requires IC 1.2.
  116.      * It is illegal to call this routine inside a ICBegin/End pair.
  117.      * Reconfigures the instance using a configuration reference that was
  118.      * got using ICGetConfigReference reference. Set the
  119.      * icNoUserInteraction_bit in flags if you require that this routine
  120.      * not present a modal dialog. Other flag bits are reserved and should
  121.      * be set to zero.
  122.      * ref must not be nil.
  123.      *)
  124.   
  125.   function ICSpecifyConfigFile(inst : ICInstance; var config : FSSpec) : ICError;
  126.     (* It is illegal to call this routine inside a ICBegin/End pair.
  127.      * For use only by the IC application.
  128.      * If you call this routine yourself, you will conflict with any
  129.      * future IC implementation that doesn't use explicit preference files.
  130.      *)
  131.   
  132.   (* ***** Getting Information ***** *)
  133.   
  134.   function ICGetSeed(inst : ICInstance; var seed : longint) : ICError;
  135.     (* You do not have to specify a configuration before calling this routine.
  136.      * You do not have to be inside an ICBegin/End pair to call this routine.
  137.      * Returns the current seed for the IC prefs database.
  138.      * This seed changes each time a non-volatile preference is changed.
  139.      * You can poll this to determine if any cached preferences change.
  140.      *)
  141.   
  142.   function ICGetPerm(inst : ICInstance; var perm : ICPerm) : ICError;
  143.     (* You do not have to specify a configuration before calling this routine.
  144.      * Returns the access permissions currently associated with this instance.
  145.      * While applications normally know what permissions they have,
  146.      * this routine is designed for use by override components.
  147.      *)
  148.   
  149.   function ICDefaultFileName(inst : ICInstance; var name : Str63) : ICError;
  150.     (* You do not have to specify a configuration before calling this routine.
  151.      * You do not have to be inside an ICBegin/End pair to call this routine.
  152.      * Returns the default file name for IC preference files.
  153.      * Applications should never need to call this routine.
  154.      * If you rely on information returned by this routine yourself,
  155.      * you may conflict with any future IC implementation that doesn't use
  156.      * explicit preference files.
  157.      * The component calls this routine to set up the default IC file name.
  158.      * This allows this operation to be intercepted by a component that has
  159.      * captured us. It currently gets it from the component resource file.
  160.      * The glue version is hardwired to "Internet Preferences".
  161.      *)
  162.   
  163.   function ICGetComponentInstance(inst : ICInstance; var component_inst : univ Ptr) : ICError;
  164.     (* Requires IC 1.2.
  165.      * You do not have to specify a configuration before calling this routine.
  166.      * You do not have to be inside an ICBegin/End pair to call this routine.
  167.      * Returns noErr and the connection to the IC component,
  168.      * if we're using the component.
  169.      * Returns badComponenInstance and nil if we're operating with glue.
  170.      * The component_inst parameter is a universal pointer to avoid
  171.      * us having to include Component.[ph] (which is not available under
  172.      * some development environments) in order to use IC.
  173.      *)
  174.   
  175.   (* ***** Reading and Writing Preferences ***** *)
  176.   
  177.   function ICBegin(inst : ICInstance; perm : ICPerm) : ICError;
  178.     (* You must specify a configuration before calling this routine.
  179.      * It is illegal to call this routine inside a ICBegin/End pair.
  180.      * Starting reading or writing multiple preferences.
  181.      * A call to this must be balanced by a call to ICEnd.
  182.      * Do not call WaitNextEvent between these calls.
  183.      * The perm specifies whether you intend to read or read/write.
  184.      * Only one writer is allowed per instance.
  185.      * Note that this may open resource files that are not closed
  186.      * until you call ICEnd.
  187.      *)
  188.   
  189.   function ICGetPref(inst : ICInstance; key : Str255; var attr : ICAttr; buf : Ptr; var size : longint) : ICError;
  190.     (* You must specify a configuration before calling this routine.
  191.      * If you are getting or setting multiple preferences, you should place
  192.      * these calls within an ICBegin/ICEnd pair.
  193.      * If you call this routine outside of such a pair, it implicitly
  194.      * calls ICBegin(inst, icReadOnlyPerm).
  195.      * Reads the preference specified by key from the IC database to the
  196.      * buffer pointed to by buf and size.
  197.      * key must not be the empty string.
  198.      * If buf is nil then no data is returned.
  199.      * size must be non-negative.
  200.      * attr and size are always set on return. On errors (except icTruncatedErr)
  201.      * attr is set to ICattr_no_change and size is set to 0.
  202.      * size is the actual size of the data.
  203.      * attr is set to the attributes associated with the preference.
  204.      * If this routine returns icTruncatedErr then the other returned
  205.      * values are valid except that only the first size bytes have been
  206.      * return. size is adjusted to reflect the true size of the preference.
  207.      * Returns icPrefNotFound if there is no preference for the key.
  208.      *)
  209.   
  210.   function ICSetPref(inst : ICInstance; key : Str255; attr : ICAttr; buf : Ptr; size : longint) : ICError;
  211.     (* You must specify a configuration before calling this routine.
  212.      * If you are getting or setting multiple preferences, you should place
  213.      * these calls within an ICBegin/ICEnd pair.
  214.      * If you call this routine outside of such a pair, it implicitly
  215.      * calls ICBegin(inst, icReadWritePerm).
  216.      * Sets the preference specified by key from the IC database to the
  217.      * value pointed to by buf and size.
  218.      * key must not be the empty string.
  219.      * size must be non-negative. 
  220.      * If buf is nil then the preference value is not set and size is ignored.
  221.      * If buf is not nil then the preference value is set to the size
  222.      * bytes pointed to by buf.
  223.      * If attr is ICattr_no_change then the preference attributes are not set.
  224.      * Otherwise the preference attributes are set to attr.
  225.      * Returns icPermErr if the previous ICBegin was passed icReadOnlyPerm.
  226.      * Returns icPermErr if current attr is locked, new attr is locked and buf <> nil.
  227.      *)
  228.   
  229.   function ICFindPrefHandle(inst : ICInstance; key : Str255; var attr : ICAttr; prefh : Handle) : ICError;
  230.     (* Requires IC 1.2.
  231.      * You must specify a configuration before calling this routine.
  232.      * If you are getting or setting multiple preferences, you should place
  233.      * these calls within an ICBegin/ICEnd pair.
  234.      * If you call this routine outside of such a pair, it implicitly
  235.      * calls ICBegin(inst, icReadWritePerm).
  236.      * This routine effectively replaces ICGetPrefHandle.
  237.      * Reads the preference specified by key from the IC database into
  238.      * a handle, prefh.
  239.      * key must not be the empty string.
  240.      * attr is set to the attributes associated with the preference.
  241.      * You must set prefh to a non-nil handle before calling this routine.
  242.      * If the preference does not exist, icPrefNotFoundErr is returned.
  243.      *)
  244.   
  245.   function ICGetPrefHandle(inst : ICInstance; key : Str255; var attr : ICAttr; var prefh : Handle) : ICError;
  246.     (* Requires IC 1.1.
  247.      * You must specify a configuration before calling this routine.
  248.      * If you are getting or setting multiple preferences, you should place
  249.      * these calls within an ICBegin/ICEnd pair.
  250.      * If you call this routine outside of such a pair, it implicitly
  251.      * calls ICBegin(inst, icReadOnlyPerm).
  252.      * This routine is now obsolete. Use ICFindPrefHandle instead.
  253.      * Reads the preference specified by key from the IC database into
  254.      * a newly created handle, prefh.
  255.      * key must not be the empty string.
  256.      * attr is set to the attributes associated with the preference.
  257.      * The incoming value of prefh is ignored.
  258.      * A new handle is created in the current heap and returned in prefh.
  259.      * If the routine returns an error, prefh is set to nil.
  260.      * If the preference does not exist, no error is returned and prefh is set
  261.      * to an empty handle.
  262.      *)
  263.   
  264.   function ICSetPrefHandle(inst : ICInstance; key : Str255; attr : ICAttr; prefh : Handle) : ICError;
  265.     (* Requires IC 1.1.
  266.      * You must specify a configuration before calling this routine.
  267.      * If you are getting or setting multiple preferences, you should place
  268.      * these calls within an ICBegin/ICEnd pair.
  269.      * If you call this routine outside of such a pair, it implicitly
  270.      * calls ICBegin(inst, icReadWritePerm).
  271.      * Sets the preference specified by key from the IC database to the
  272.      * value contained in prefh.
  273.      * key must not be the empty string.
  274.      * If prefh is nil then the preference value is not set.
  275.      * If buf is not nil then the preference value is set to the data
  276.      * contained in it.
  277.      * If attr is ICattr_no_change then the preference attributes are not set.
  278.      * Otherwise the preference attributes are set to attr.
  279.      * Returns icPermErr if the previous ICBegin was passed icReadOnlyPerm.
  280.      * Returns icPermErr if current attr is locked, new attr is locked and prefh <> nil.
  281.      *)
  282.   
  283.   function ICCountPref(inst : ICInstance; var count : longint) : ICError;
  284.     (* You must specify a configuration before calling this routine.
  285.      * You must be inside an ICBegin/End pair to call this routine.
  286.      * Counts the total number of preferences.
  287.      * If the routine returns an error, count is set to 0.
  288.      *)
  289.   
  290.   function ICGetIndPref(inst : ICInstance; n : longint; var key : Str255) : ICError;
  291.     (* You must specify a configuration before calling this routine.
  292.      * You must be inside an ICBegin/End pair to call this routine.
  293.      * Returns the key of the Nth preference.
  294.      * n must be positive.
  295.      * Returns icPrefNotFoundErr if n is greater than the total number of preferences.
  296.      * If the routine returns an error, key is undefined.
  297.      *)
  298.   
  299.   function ICDeletePref(inst : ICInstance; key : Str255) : ICError;
  300.     (* You must specify a configuration before calling this routine.
  301.      * You must be inside an ICBegin/End pair to call this routine.
  302.      * Deletes the preference specified by key.
  303.      * key must not be the empty string.
  304.      * Returns icPrefNotFound if the preference specified by key is not present.
  305.      *)
  306.   
  307.   function ICEnd(inst : ICInstance) : ICError;
  308.     (* You must specify a configuration before calling this routine.
  309.      * You must be inside an ICBegin/End pair to call this routine.
  310.      * Terminates a preference session, as started by ICBegin.
  311.      * You must have called ICBegin before calling this routine.
  312.      *)
  313.   
  314.   (* ***** User Interface Stuff ***** *)
  315.   
  316.   function ICEditPreferences(inst : ICInstance; key : Str255) : ICError;
  317.     (* Requires IC 1.1.
  318.      * You must specify a configuration before calling this routine.
  319.      * You do not have to be inside an ICBegin/End pair to call this routine.
  320.      * Instructs IC to display the user interface associated with editing
  321.      * preferences and focusing on the preference specified by key.
  322.      * If key is the empty string then no preference should be focused upon.
  323.      * You must have specified a configuration before calling this routine.
  324.      * You do not need to call ICBegin before calling this routine.
  325.      * In the current implementation this launches the IC application
  326.      * (or brings it to the front) and displays the window containing
  327.      * the preference specified by key.
  328.      * It may have a radically different implementation in future
  329.      * IC systems.
  330.      *)
  331.   
  332.   (* ***** URL Handling ***** *)
  333.   
  334.   function ICParseURL(inst : ICInstance; hint : Str255; data : Ptr; len : longint; var selStart : longint; var selEnd : longint; url : Handle) : ICError;
  335.     (* Requires IC 1.1.
  336.      * You must specify a configuration before calling this routine.
  337.      * You do not have to be inside an ICBegin/End pair to call this routine.
  338.      * Parses a URL out of the specified text and returns it in a canonical form
  339.      * in a handle.
  340.      * hint indicates the default scheme for URLs of the form "name@address".
  341.      * If hint is the empty string then URLs of that form are not allowed.
  342.      * data points to the start of the text. It must not be nil.
  343.      * len indicates the length of the text. It must be non-negative.
  344.      * selStart and selEnd should be passed in as the current selection of
  345.      * the text. This selection is given in the same manner as TextEdit,
  346.      * ie if selStart = selEnd then there is no selection only an insertion
  347.      * point. Also selStart イ selEnd and 0 イ selStart イ len and 0 イ selEnd イ len.
  348.      * selStart and selEnd are returned as the bounds of the URL. If the
  349.      * routine returns an error then these new boundaries may be
  350.      * invalid but they will be close.
  351.      * The incoming url handle must not be nil.  The resulting URL is normalised
  352.      * and copied into the url handle, which is resized to fit.
  353.      *)
  354.   
  355.   function ICLaunchURL(inst : ICInstance; hint : Str255; data : Ptr; len : longint; var selStart : longint; var selEnd : longint) : ICError;
  356.     (* Requires IC 1.1.
  357.      * You must specify a configuration before calling this routine.
  358.      * You do not have to be inside an ICBegin/End pair to call this routine.
  359.      * Parses a URL out of the specified text and feeds it off to the
  360.      * appropriate helper.
  361.      * hint indicates the default scheme for URLs of the form "name@address".
  362.      * If hint is the empty string then URLs of that form are not allowed.
  363.      * data points to the start of the text. It must not be nil.
  364.      * len indicates the length of the text. It must be non-negative.
  365.      * selStart and selEnd should be passed in as the current selection of
  366.      * the text. This selection is given in the same manner as TextEdit,
  367.      * ie if selStart = selEnd then there is no selection only an insertion
  368.      * point. Also selStart イ selEnd and 0 イ selStart イ len and 0 イ selEnd イ len.
  369.      * selStart and selEnd are returned as the bounds of the URL. If the
  370.      * routine returns an error then these new boundaries may be
  371.      * invalid but they will be close.
  372.      * The URL is parsed out of the text and passed off to the appropriate
  373.      * helper using the GURL AppleEvent.
  374.      *)
  375.   
  376.   (* ***** Mappings Routines *****
  377.    * 
  378.    * Routines for interrogating mappings database.
  379.    * 
  380.    * ----- High Level Routines -----
  381.    *)
  382.   
  383.   function ICMapFilename(inst : ICInstance; filename : Str255; var entry : ICMapEntry) : ICError;
  384.     (* Requires IC 1.1.
  385.      * You must specify a configuration before calling this routine.
  386.      * If you are getting or setting multiple preferences, you should place
  387.      * these calls within an ICBegin/ICEnd pair.
  388.      * If you call this routine outside of such a pair, it implicitly
  389.      * calls ICBegin(inst, icReadWritePerm).
  390.      * Takes the name of an incoming file and returns the most appropriate
  391.      * mappings database entry, based on its extension.
  392.      * filename must not be the empty string.
  393.      * Returns icPrefNotFoundErr if no suitable entry is found.
  394.      *)
  395.   
  396.   function ICMapTypeCreator(inst : ICInstance; fType : OSType; fCreator : OSType; filename : Str255; var entry : ICMapEntry) : ICError;
  397.     (* Requires IC 1.1.
  398.      * You must specify a configuration before calling this routine.
  399.      * You must be inside an ICBegin/End pair to call this routine.
  400.      * Takes the type and creator (and optionally the name) of an outgoing
  401.      * file and returns the most appropriate mappings database entry.
  402.      * The filename may be either the name of the outgoing file or
  403.      * the empty string.
  404.      * Returns icPrefNotFoundErr if no suitable entry found.
  405.      *)
  406.   
  407.   (* ----- Mid Level Routines ----- *)
  408.   
  409.   function ICMapEntriesFilename(inst : ICInstance; entries : Handle; filename : Str255; var entry : ICMapEntry) : ICError;
  410.     (* Requires IC 1.1.
  411.      * You must specify a configuration before calling this routine.
  412.      * You do not have to be inside an ICBegin/End pair to call this routine.
  413.      * Takes the name of an incoming file and returns the most appropriate
  414.      * mappings database entry, based on its extension.
  415.      * entries must be a handle to a valid IC mappings database preference.
  416.      * filename must not be the empty string.
  417.      * Returns icPrefNotFoundErr if no suitable entry is found.
  418.      *)
  419.   
  420.   function ICMapEntriesTypeCreator(inst : ICInstance; entries : Handle; fType : OSType; fCreator : OSType; filename : Str255; var entry : ICMapEntry) : ICError;
  421.     (* Requires IC 1.1.
  422.      * You must specify a configuration before calling this routine.
  423.      * You do not have to be inside an ICBegin/End pair to call this routine.
  424.      * Takes the type and creator (and optionally the name) of an outgoing
  425.      * file and returns the most appropriate mappings database entry.
  426.      * entries must be a handle to a valid IC mappings database preference.
  427.      * The filename may be either the name of the outgoing file or
  428.      * the empty string.
  429.      * Returns icPrefNotFoundErr if no suitable entry found.
  430.      *)
  431.   
  432.   (* ----- Low Level Routines ----- *)
  433.   
  434.   function ICCountMapEntries(inst : ICInstance; entries : Handle; var count : longint) : ICError;
  435.     (* Requires IC 1.1.
  436.      * You must specify a configuration before calling this routine.
  437.      * You do not have to be inside an ICBegin/End pair to call this routine.
  438.      * Counts the number of entries in the mappings database.
  439.      * entries must be a handle to a valid IC mappings database preference.
  440.      * count is set to the number of entries.
  441.      *)
  442.   
  443.   function ICGetIndMapEntry(inst : ICInstance; entries : Handle; ndx : longint; var pos : longint; var entry : ICMapEntry) : ICError;
  444.     (* Requires IC 1.1.
  445.      * You must specify a configuration before calling this routine.
  446.      * You do not have to be inside an ICBegin/End pair to call this routine.
  447.      * Gets the ndx'th entry in the mappings database.
  448.      * entries must be a handle to a valid IC mappings database preference.
  449.      * ndx must be in the range from 1 to the number of entries in the database.
  450.      * The value of pos is ignored on input. pos is set to the position of
  451.      * the ndx'th entry in the database and is suitable for passing back
  452.      * into ICSetMapEntry.
  453.      * Does not return any user data associated with the entry.
  454.      *)
  455.   
  456.   function ICGetMapEntry(inst : ICInstance; entries : Handle; pos : longint; var entry : ICMapEntry) : ICError;
  457.     (* Requires IC 1.1.
  458.      * You must specify a configuration before calling this routine.
  459.      * You do not have to be inside an ICBegin/End pair to call this routine.
  460.      * Returns the entry located at position pos in the mappings database.
  461.      * entries must be a handle to a valid IC mappings database preference.
  462.      * pos should be 0 to get the first entry. To get the subsequent entries, add
  463.      * entry.total_size to pos and iterate.
  464.      * Does not return any user data associated with the entry.
  465.      *)
  466.   
  467.   function ICSetMapEntry(inst : ICInstance; entries : Handle; pos : longint; var entry : ICMapEntry) : ICError;
  468.     (* Requires IC 1.1.
  469.      * You must specify a configuration before calling this routine.
  470.      * You do not have to be inside an ICBegin/End pair to call this routine.
  471.      * Sets the entry located at position pos in the mappings database.
  472.      * entries must be a handle to a valid IC mappings database preference.
  473.      * pos should be either a value returned from ICGetIndMapEntry or a value
  474.      * calculated using ICGetMapEntry.
  475.      * entry is a var parameter purely for stack space reasons. It is not
  476.      * modified in any way.
  477.      * Any user data associated with the entry is unmodified.
  478.      *)
  479.   
  480.   function ICDeleteMapEntry(inst : ICInstance; entries : Handle; pos : longint) : ICError;
  481.     (* Requires IC 1.1.
  482.      * You must specify a configuration before calling this routine.
  483.      * You do not have to be inside an ICBegin/End pair to call this routine.
  484.      * Deletes the mappings database entry at pos.
  485.      * entries must be a handle to a valid IC mappings database preference.
  486.      * pos should be either a value returned from ICGetIndMapEntry or a value
  487.      * calculated using ICGetMapEntry.
  488.      * Also deletes any user data associated with the entry.
  489.      *)
  490.   
  491.   function ICAddMapEntry(inst : ICInstance; entries : Handle; var entry : ICMapEntry) : ICError;
  492.     (* Requires IC 1.1.
  493.      * You must specify a configuration before calling this routine.
  494.      * You do not have to be inside an ICBegin/End pair to call this routine.
  495.      * Adds an entry to the mappings database.
  496.      * entries must be a handle to a valid IC mappings database preference.
  497.      * The entry is added to the end of the entries database.
  498.      * No user data is added.
  499.      *)
  500.   
  501.  
  502. (* ・・・End ICAPI.p・・・ *)
  503.  
  504. implementation
  505.  
  506.     uses
  507. {$ifc undefined THINK_Pascal}
  508.         Components, Memory, 
  509. {$endc}
  510.         ICCAPIGlue, ICLinkIn;
  511.  
  512.     function ICStart (var inst: ICInstance; creator: OSType): ICError;
  513.         var
  514.             err: ICError;
  515.     begin
  516.         inst := NewPtr(sizeof(ICRRecord));
  517.         err := MemError;
  518.         if err = noErr then begin
  519.             err := ICCStart(ICRRecordPtr(inst)^.instance, creator);
  520.             if err <> noErr then begin
  521.                 err := ICRStart(ICRRecordPtr(inst)^, creator);
  522.             end; (* if *)
  523.             if err <> noErr then begin
  524.                 DisposePtr(inst);
  525.                 inst := nil;
  526.             end; (* if *)
  527.         end; (* if *)
  528.         ICStart := err;
  529.     end; (* ICStart *)
  530.  
  531.     function ICStop (inst: ICInstance): ICError;
  532.         var
  533.             err, err2: ICError;
  534.     begin
  535.         if ICRRecordPtr(inst)^.instance <> nil then begin
  536.             err := ICCStop(ICRRecordPtr(inst)^.instance);
  537.         end
  538.         else begin
  539.             err := ICRStop(ICRRecordPtr(inst)^);
  540.         end; (* if *)
  541.         DisposePtr(inst);
  542.         ICStop := err;
  543.     end; (* ICStop *)
  544.  
  545.     function ICGetComponentInstance (inst: ICInstance; var component_inst: univ Ptr): ICError;
  546.     begin
  547.         component_inst := Ptr(ICRRecordPtr(inst)^.instance);
  548.         if component_inst = nil then begin
  549.             ICGetComponentInstance := badComponentInstance;
  550.         end
  551.         else begin
  552.             ICGetComponentInstance := noErr;
  553.         end; (* if *)
  554.     end; (* ICGetComponentInstance *)
  555.  
  556. (* ・・・Start ICAPI.p1・・・ *)
  557.  
  558.   function ICFindConfigFile(inst : ICInstance; count : integer; folders : ICDirSpecArrayPtr) : ICError;
  559.   begin
  560.     if ICRRecordPtr(inst)^.instance <> nil then begin
  561.       ICFindConfigFile := ICCFindConfigFile(ICRRecordPtr(inst)^.instance, count, folders);
  562.     end else begin
  563.       ICFindConfigFile := ICRFindConfigFile(ICRRecordPtr(inst)^, count, folders);
  564.     end; (* if *)
  565.   end; (* ICFindConfigFile *)
  566.   
  567.   function ICFindUserConfigFile(inst : ICInstance; var where : ICDirSpec) : ICError;
  568.   begin
  569.     if ICRRecordPtr(inst)^.instance <> nil then begin
  570.       ICFindUserConfigFile := ICCFindUserConfigFile(ICRRecordPtr(inst)^.instance, where);
  571.     end else begin
  572.       ICFindUserConfigFile := ICRFindUserConfigFile(ICRRecordPtr(inst)^, where);
  573.     end; (* if *)
  574.   end; (* ICFindUserConfigFile *)
  575.   
  576.   function ICGeneralFindConfigFile(inst : ICInstance; search_prefs : Boolean; can_create : Boolean; count : integer; folders : ICDirSpecArrayPtr) : ICError;
  577.   begin
  578.     if ICRRecordPtr(inst)^.instance <> nil then begin
  579.       ICGeneralFindConfigFile := ICCGeneralFindConfigFile(ICRRecordPtr(inst)^.instance, search_prefs, can_create, count, folders);
  580.     end else begin
  581.       ICGeneralFindConfigFile := ICRGeneralFindConfigFile(ICRRecordPtr(inst)^, search_prefs, can_create, count, folders);
  582.     end; (* if *)
  583.   end; (* ICGeneralFindConfigFile *)
  584.   
  585.   function ICChooseConfig(inst : ICInstance) : ICError;
  586.   begin
  587.     if ICRRecordPtr(inst)^.instance <> nil then begin
  588.       ICChooseConfig := ICCChooseConfig(ICRRecordPtr(inst)^.instance);
  589.     end else begin
  590.       ICChooseConfig := ICRChooseConfig(ICRRecordPtr(inst)^);
  591.     end; (* if *)
  592.   end; (* ICChooseConfig *)
  593.   
  594.   function ICChooseNewConfig(inst : ICInstance) : ICError;
  595.   begin
  596.     if ICRRecordPtr(inst)^.instance <> nil then begin
  597.       ICChooseNewConfig := ICCChooseNewConfig(ICRRecordPtr(inst)^.instance);
  598.     end else begin
  599.       ICChooseNewConfig := ICRChooseNewConfig(ICRRecordPtr(inst)^);
  600.     end; (* if *)
  601.   end; (* ICChooseNewConfig *)
  602.   
  603.   function ICGetConfigName(inst : ICInstance; longname : Boolean; var name : Str255) : ICError;
  604.   begin
  605.     if ICRRecordPtr(inst)^.instance <> nil then begin
  606.       ICGetConfigName := ICCGetConfigName(ICRRecordPtr(inst)^.instance, longname, name);
  607.     end else begin
  608.       ICGetConfigName := ICRGetConfigName(ICRRecordPtr(inst)^, longname, name);
  609.     end; (* if *)
  610.   end; (* ICGetConfigName *)
  611.   
  612.   function ICGetConfigReference(inst : ICInstance; ref : ICConfigRefHandle) : ICError;
  613.   begin
  614.     if ICRRecordPtr(inst)^.instance <> nil then begin
  615.       ICGetConfigReference := ICCGetConfigReference(ICRRecordPtr(inst)^.instance, ref);
  616.     end else begin
  617.       ICGetConfigReference := ICRGetConfigReference(ICRRecordPtr(inst)^, ref);
  618.     end; (* if *)
  619.   end; (* ICGetConfigReference *)
  620.   
  621.   function ICSetConfigReference(inst : ICInstance; ref : ICConfigRefHandle; flags : longint) : ICError;
  622.   begin
  623.     if ICRRecordPtr(inst)^.instance <> nil then begin
  624.       ICSetConfigReference := ICCSetConfigReference(ICRRecordPtr(inst)^.instance, ref, flags);
  625.     end else begin
  626.       ICSetConfigReference := ICRSetConfigReference(ICRRecordPtr(inst)^, ref, flags);
  627.     end; (* if *)
  628.   end; (* ICSetConfigReference *)
  629.   
  630.   function ICSpecifyConfigFile(inst : ICInstance; var config : FSSpec) : ICError;
  631.   begin
  632.     if ICRRecordPtr(inst)^.instance <> nil then begin
  633.       ICSpecifyConfigFile := ICCSpecifyConfigFile(ICRRecordPtr(inst)^.instance, config);
  634.     end else begin
  635.       ICSpecifyConfigFile := ICRSpecifyConfigFile(ICRRecordPtr(inst)^, config);
  636.     end; (* if *)
  637.   end; (* ICSpecifyConfigFile *)
  638.   
  639.   function ICGetSeed(inst : ICInstance; var seed : longint) : ICError;
  640.   begin
  641.     if ICRRecordPtr(inst)^.instance <> nil then begin
  642.       ICGetSeed := ICCGetSeed(ICRRecordPtr(inst)^.instance, seed);
  643.     end else begin
  644.       ICGetSeed := ICRGetSeed(ICRRecordPtr(inst)^, seed);
  645.     end; (* if *)
  646.   end; (* ICGetSeed *)
  647.   
  648.   function ICGetPerm(inst : ICInstance; var perm : ICPerm) : ICError;
  649.   begin
  650.     if ICRRecordPtr(inst)^.instance <> nil then begin
  651.       ICGetPerm := ICCGetPerm(ICRRecordPtr(inst)^.instance, perm);
  652.     end else begin
  653.       ICGetPerm := ICRGetPerm(ICRRecordPtr(inst)^, perm);
  654.     end; (* if *)
  655.   end; (* ICGetPerm *)
  656.   
  657.   function ICDefaultFileName(inst : ICInstance; var name : Str63) : ICError;
  658.   begin
  659.     if ICRRecordPtr(inst)^.instance <> nil then begin
  660.       ICDefaultFileName := ICCDefaultFileName(ICRRecordPtr(inst)^.instance, name);
  661.     end else begin
  662.       ICDefaultFileName := ICRDefaultFileName(ICRRecordPtr(inst)^, name);
  663.     end; (* if *)
  664.   end; (* ICDefaultFileName *)
  665.   
  666.   function ICBegin(inst : ICInstance; perm : ICPerm) : ICError;
  667.   begin
  668.     if ICRRecordPtr(inst)^.instance <> nil then begin
  669.       ICBegin := ICCBegin(ICRRecordPtr(inst)^.instance, perm);
  670.     end else begin
  671.       ICBegin := ICRBegin(ICRRecordPtr(inst)^, perm);
  672.     end; (* if *)
  673.   end; (* ICBegin *)
  674.   
  675.   function ICGetPref(inst : ICInstance; key : Str255; var attr : ICAttr; buf : Ptr; var size : longint) : ICError;
  676.   begin
  677.     if ICRRecordPtr(inst)^.instance <> nil then begin
  678.       ICGetPref := ICCGetPref(ICRRecordPtr(inst)^.instance, key, attr, buf, size);
  679.     end else begin
  680.       ICGetPref := ICRGetPref(ICRRecordPtr(inst)^, key, attr, buf, size);
  681.     end; (* if *)
  682.   end; (* ICGetPref *)
  683.   
  684.   function ICSetPref(inst : ICInstance; key : Str255; attr : ICAttr; buf : Ptr; size : longint) : ICError;
  685.   begin
  686.     if ICRRecordPtr(inst)^.instance <> nil then begin
  687.       ICSetPref := ICCSetPref(ICRRecordPtr(inst)^.instance, key, attr, buf, size);
  688.     end else begin
  689.       ICSetPref := ICRSetPref(ICRRecordPtr(inst)^, key, attr, buf, size);
  690.     end; (* if *)
  691.   end; (* ICSetPref *)
  692.   
  693.   function ICFindPrefHandle(inst : ICInstance; key : Str255; var attr : ICAttr; prefh : Handle) : ICError;
  694.   begin
  695.     if ICRRecordPtr(inst)^.instance <> nil then begin
  696.       ICFindPrefHandle := ICCFindPrefHandle(ICRRecordPtr(inst)^.instance, key, attr, prefh);
  697.     end else begin
  698.       ICFindPrefHandle := ICRFindPrefHandle(ICRRecordPtr(inst)^, key, attr, prefh);
  699.     end; (* if *)
  700.   end; (* ICFindPrefHandle *)
  701.   
  702.   function ICGetPrefHandle(inst : ICInstance; key : Str255; var attr : ICAttr; var prefh : Handle) : ICError;
  703.   begin
  704.     if ICRRecordPtr(inst)^.instance <> nil then begin
  705.       ICGetPrefHandle := ICCGetPrefHandle(ICRRecordPtr(inst)^.instance, key, attr, prefh);
  706.     end else begin
  707.       ICGetPrefHandle := ICRGetPrefHandle(ICRRecordPtr(inst)^, key, attr, prefh);
  708.     end; (* if *)
  709.   end; (* ICGetPrefHandle *)
  710.   
  711.   function ICSetPrefHandle(inst : ICInstance; key : Str255; attr : ICAttr; prefh : Handle) : ICError;
  712.   begin
  713.     if ICRRecordPtr(inst)^.instance <> nil then begin
  714.       ICSetPrefHandle := ICCSetPrefHandle(ICRRecordPtr(inst)^.instance, key, attr, prefh);
  715.     end else begin
  716.       ICSetPrefHandle := ICRSetPrefHandle(ICRRecordPtr(inst)^, key, attr, prefh);
  717.     end; (* if *)
  718.   end; (* ICSetPrefHandle *)
  719.   
  720.   function ICCountPref(inst : ICInstance; var count : longint) : ICError;
  721.   begin
  722.     if ICRRecordPtr(inst)^.instance <> nil then begin
  723.       ICCountPref := ICCCountPref(ICRRecordPtr(inst)^.instance, count);
  724.     end else begin
  725.       ICCountPref := ICRCountPref(ICRRecordPtr(inst)^, count);
  726.     end; (* if *)
  727.   end; (* ICCountPref *)
  728.   
  729.   function ICGetIndPref(inst : ICInstance; n : longint; var key : Str255) : ICError;
  730.   begin
  731.     if ICRRecordPtr(inst)^.instance <> nil then begin
  732.       ICGetIndPref := ICCGetIndPref(ICRRecordPtr(inst)^.instance, n, key);
  733.     end else begin
  734.       ICGetIndPref := ICRGetIndPref(ICRRecordPtr(inst)^, n, key);
  735.     end; (* if *)
  736.   end; (* ICGetIndPref *)
  737.   
  738.   function ICDeletePref(inst : ICInstance; key : Str255) : ICError;
  739.   begin
  740.     if ICRRecordPtr(inst)^.instance <> nil then begin
  741.       ICDeletePref := ICCDeletePref(ICRRecordPtr(inst)^.instance, key);
  742.     end else begin
  743.       ICDeletePref := ICRDeletePref(ICRRecordPtr(inst)^, key);
  744.     end; (* if *)
  745.   end; (* ICDeletePref *)
  746.   
  747.   function ICEnd(inst : ICInstance) : ICError;
  748.   begin
  749.     if ICRRecordPtr(inst)^.instance <> nil then begin
  750.       ICEnd := ICCEnd(ICRRecordPtr(inst)^.instance);
  751.     end else begin
  752.       ICEnd := ICREnd(ICRRecordPtr(inst)^);
  753.     end; (* if *)
  754.   end; (* ICEnd *)
  755.   
  756.   function ICEditPreferences(inst : ICInstance; key : Str255) : ICError;
  757.   begin
  758.     if ICRRecordPtr(inst)^.instance <> nil then begin
  759.       ICEditPreferences := ICCEditPreferences(ICRRecordPtr(inst)^.instance, key);
  760.     end else begin
  761.       ICEditPreferences := ICREditPreferences(ICRRecordPtr(inst)^, key);
  762.     end; (* if *)
  763.   end; (* ICEditPreferences *)
  764.   
  765.   function ICParseURL(inst : ICInstance; hint : Str255; data : Ptr; len : longint; var selStart : longint; var selEnd : longint; url : Handle) : ICError;
  766.   begin
  767.     if ICRRecordPtr(inst)^.instance <> nil then begin
  768.       ICParseURL := ICCParseURL(ICRRecordPtr(inst)^.instance, hint, data, len, selStart, selEnd, url);
  769.     end else begin
  770.       ICParseURL := ICRParseURL(ICRRecordPtr(inst)^, hint, data, len, selStart, selEnd, url);
  771.     end; (* if *)
  772.   end; (* ICParseURL *)
  773.   
  774.   function ICLaunchURL(inst : ICInstance; hint : Str255; data : Ptr; len : longint; var selStart : longint; var selEnd : longint) : ICError;
  775.   begin
  776.     if ICRRecordPtr(inst)^.instance <> nil then begin
  777.       ICLaunchURL := ICCLaunchURL(ICRRecordPtr(inst)^.instance, hint, data, len, selStart, selEnd);
  778.     end else begin
  779.       ICLaunchURL := ICRLaunchURL(ICRRecordPtr(inst)^, hint, data, len, selStart, selEnd);
  780.     end; (* if *)
  781.   end; (* ICLaunchURL *)
  782.   
  783.   function ICMapFilename(inst : ICInstance; filename : Str255; var entry : ICMapEntry) : ICError;
  784.   begin
  785.     if ICRRecordPtr(inst)^.instance <> nil then begin
  786.       ICMapFilename := ICCMapFilename(ICRRecordPtr(inst)^.instance, filename, entry);
  787.     end else begin
  788.       ICMapFilename := ICRMapFilename(ICRRecordPtr(inst)^, filename, entry);
  789.     end; (* if *)
  790.   end; (* ICMapFilename *)
  791.   
  792.   function ICMapTypeCreator(inst : ICInstance; fType : OSType; fCreator : OSType; filename : Str255; var entry : ICMapEntry) : ICError;
  793.   begin
  794.     if ICRRecordPtr(inst)^.instance <> nil then begin
  795.       ICMapTypeCreator := ICCMapTypeCreator(ICRRecordPtr(inst)^.instance, fType, fCreator, filename, entry);
  796.     end else begin
  797.       ICMapTypeCreator := ICRMapTypeCreator(ICRRecordPtr(inst)^, fType, fCreator, filename, entry);
  798.     end; (* if *)
  799.   end; (* ICMapTypeCreator *)
  800.   
  801.   function ICMapEntriesFilename(inst : ICInstance; entries : Handle; filename : Str255; var entry : ICMapEntry) : ICError;
  802.   begin
  803.     if ICRRecordPtr(inst)^.instance <> nil then begin
  804.       ICMapEntriesFilename := ICCMapEntriesFilename(ICRRecordPtr(inst)^.instance, entries, filename, entry);
  805.     end else begin
  806.       ICMapEntriesFilename := ICRMapEntriesFilename(ICRRecordPtr(inst)^, entries, filename, entry);
  807.     end; (* if *)
  808.   end; (* ICMapEntriesFilename *)
  809.   
  810.   function ICMapEntriesTypeCreator(inst : ICInstance; entries : Handle; fType : OSType; fCreator : OSType; filename : Str255; var entry : ICMapEntry) : ICError;
  811.   begin
  812.     if ICRRecordPtr(inst)^.instance <> nil then begin
  813.       ICMapEntriesTypeCreator := ICCMapEntriesTypeCreator(ICRRecordPtr(inst)^.instance, entries, fType, fCreator, filename, entry);
  814.     end else begin
  815.       ICMapEntriesTypeCreator := ICRMapEntriesTypeCreator(ICRRecordPtr(inst)^, entries, fType, fCreator, filename, entry);
  816.     end; (* if *)
  817.   end; (* ICMapEntriesTypeCreator *)
  818.   
  819.   function ICCountMapEntries(inst : ICInstance; entries : Handle; var count : longint) : ICError;
  820.   begin
  821.     if ICRRecordPtr(inst)^.instance <> nil then begin
  822.       ICCountMapEntries := ICCCountMapEntries(ICRRecordPtr(inst)^.instance, entries, count);
  823.     end else begin
  824.       ICCountMapEntries := ICRCountMapEntries(ICRRecordPtr(inst)^, entries, count);
  825.     end; (* if *)
  826.   end; (* ICCountMapEntries *)
  827.   
  828.   function ICGetIndMapEntry(inst : ICInstance; entries : Handle; ndx : longint; var pos : longint; var entry : ICMapEntry) : ICError;
  829.   begin
  830.     if ICRRecordPtr(inst)^.instance <> nil then begin
  831.       ICGetIndMapEntry := ICCGetIndMapEntry(ICRRecordPtr(inst)^.instance, entries, ndx, pos, entry);
  832.     end else begin
  833.       ICGetIndMapEntry := ICRGetIndMapEntry(ICRRecordPtr(inst)^, entries, ndx, pos, entry);
  834.     end; (* if *)
  835.   end; (* ICGetIndMapEntry *)
  836.   
  837.   function ICGetMapEntry(inst : ICInstance; entries : Handle; pos : longint; var entry : ICMapEntry) : ICError;
  838.   begin
  839.     if ICRRecordPtr(inst)^.instance <> nil then begin
  840.       ICGetMapEntry := ICCGetMapEntry(ICRRecordPtr(inst)^.instance, entries, pos, entry);
  841.     end else begin
  842.       ICGetMapEntry := ICRGetMapEntry(ICRRecordPtr(inst)^, entries, pos, entry);
  843.     end; (* if *)
  844.   end; (* ICGetMapEntry *)
  845.   
  846.   function ICSetMapEntry(inst : ICInstance; entries : Handle; pos : longint; var entry : ICMapEntry) : ICError;
  847.   begin
  848.     if ICRRecordPtr(inst)^.instance <> nil then begin
  849.       ICSetMapEntry := ICCSetMapEntry(ICRRecordPtr(inst)^.instance, entries, pos, entry);
  850.     end else begin
  851.       ICSetMapEntry := ICRSetMapEntry(ICRRecordPtr(inst)^, entries, pos, entry);
  852.     end; (* if *)
  853.   end; (* ICSetMapEntry *)
  854.   
  855.   function ICDeleteMapEntry(inst : ICInstance; entries : Handle; pos : longint) : ICError;
  856.   begin
  857.     if ICRRecordPtr(inst)^.instance <> nil then begin
  858.       ICDeleteMapEntry := ICCDeleteMapEntry(ICRRecordPtr(inst)^.instance, entries, pos);
  859.     end else begin
  860.       ICDeleteMapEntry := ICRDeleteMapEntry(ICRRecordPtr(inst)^, entries, pos);
  861.     end; (* if *)
  862.   end; (* ICDeleteMapEntry *)
  863.   
  864.   function ICAddMapEntry(inst : ICInstance; entries : Handle; var entry : ICMapEntry) : ICError;
  865.   begin
  866.     if ICRRecordPtr(inst)^.instance <> nil then begin
  867.       ICAddMapEntry := ICCAddMapEntry(ICRRecordPtr(inst)^.instance, entries, entry);
  868.     end else begin
  869.       ICAddMapEntry := ICRAddMapEntry(ICRRecordPtr(inst)^, entries, entry);
  870.     end; (* if *)
  871.   end; (* ICAddMapEntry *)
  872.   
  873.  
  874. (* ・・・End ICAPI.p1・・・ *)
  875.  
  876. end. (* ICSwitchGlue *)
  877.